package org.example.socket;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @BelongsProject: javaFoundation
 * @BelongsPackage: org.example.socket
 * @Author: dtq
 * @CreateTime: 2023-11-01  16:19
 * @Description: TODO
 * @Version: 1.0
 */
public class SocketServer {
    public static void main(String[] args) throws Exception {
        //监听端口
        ServerSocket serverSocket = new ServerSocket(8888);
        //建立连接
        Socket socket = serverSocket.accept();
        //上传文件
        //创建文件字节数组
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("E:\\yy\\壁纸.png"));
        byte[] bytes = StreamUtils.streamToByteArray(bis);

    }
}
